package bo;

/**
 */
import dao.*;
import bo.*;
import java.util.*;
public class XlsLoader {
    /**
     */
    private static String PROCEDURE_NAME = "insert_user_sp";
    private XlsFile xlsfile;

    /**
     */
    private StoredProcedure proc;

    /**
     * @return 
     */
    public XlsLoader(String file) {
        xlsfile = new XlsFile(file);
        proc=new StoredProcedure(PROCEDURE_NAME);
    }
    public boolean load() throws Exception {
        Vector<Vector<String>> data = xlsfile.getData();
        // setear el estado de la base de datos
        DbHandler handler = new DbHandler();
        for(Vector<String> tuple:data) {
            if(proc.run(tuple,handler)==false) return false;
        }
        return true;
    }

    /**
     * @return 
     */
    public XlsFile getXlsfile() {
        return this.xlsfile;
    }

    /**
     * @param xlsfile 
     */
    public void setXlsfile(XlsFile xlsfile) {
          this.xlsfile=xlsfile;
    }

    /**
     * @return 
     */
    public StoredProcedure getProcInfo() {
        return this.proc;
    }

    /**
     * @param procInfo 
     */
    public void setProcInfo(StoredProcedure procInfo) {
        this.proc=procInfo;
    }
}

